#pragma once
#include	"../sqlite/sqlite3.h"
#include	<stdio.h>
#include	<stdlib.h>
#include	<time.h>
#include	<string.h>

#define	PAOMA_SQLITE_FILE	"data.db"
#define CREATE_PAOMA_TABLE	"CREATE TABLE PaoMa (f INT,s INT,m INT,i INT,d TEXT)"
#define INSERT_PAOMA_TABLE	"INSERT INTO PaoMa VALUES(%d,%d,%d,%d,'%s')" 
#define SELECT_PAOMA_TABLE	"SELECT * FROM PaoMa"
#define DELETE_PAOMA_TABLE	"DELETE FROM PaoMa"


typedef struct pamamsg
{
	int first,second,mul,index;
	char date[64];
}PaoMaMSG;


typedef int (*PM_CALLBACK)(PaoMaMSG& msg,void* opt);


class Lsqlite
{
public:
	Lsqlite();
	~Lsqlite();

public:
	sqlite3* m_sql;

protected:
	int DoCommand(char* cmd);

public:
	int Open();
	int Close();
	int CreateTable();
	int DeleteTable();

	int Insert(int first,int second,int mul,int index,char* date);
	int Insert(PaoMaMSG& msg);

	int Query(PM_CALLBACK callfunc,void* opt);
};